import requests
class LoginApi:
    def login(self,resp_data):
        resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/login",
                             json=resp_data)
        return resp
    def lingpai(self):
        resp = self.login(resp_data)
        lingpai=resp.json().get("data")
        s = {"Authorization":str(lingpai)}
        return s

    def tianjia(self,req_data):
        a = self.lingpai()
        resp1 = requests.post(url="http://ihrm2-test.itheima.net/api/sys/user",
                             headers=a,json=req_data)
        return resp1





if __name__=="__main__":
    A = LoginApi()
    resp_data = {"mobile": "13800000002", "password": "123456"}
    resp = A.login(resp_data)
    print(A.lingpai())
    req_data = {"username":"lalala","mobile":"18645623945","workNumber":"623456123"}
    resp1 = A.tianjia(req_data)
    print(resp1.json())

